//
//  YLIntegralController.m
//  YLFinanceService
//
//  Created by she1323 on 2017/9/19.
//  Copyright © 2017年 she1323. All rights reserved.
//

#import "YLIntegralController.h"
#import "YLIntegralRecordViewController.h"
#import "YLMoreIntegralController.h"
#import <Masonry.h>
@interface YLIntegralController ()
@property (weak, nonatomic) IBOutlet UIView *tableBaseView;
@property (nonatomic, weak) UIView *moreIntegralView;
@property (nonatomic, weak) UIView *integralRecordView;
@property (weak, nonatomic) IBOutlet UILabel *totalPointLabel;

@end

@implementation YLIntegralController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"积分";
    
    YLIntegralRecordViewController *integralRecord = [[YLIntegralRecordViewController alloc] init];
    _integralRecordView = integralRecord.view;
    _integralRecordView.hidden = NO;
    [self addChildViewController:integralRecord];
    [_tableBaseView addSubview:integralRecord.view];
    __weak typeof(self) weakSelf = self;
    [integralRecord.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.right.bottom.left.mas_equalTo(weakSelf.tableBaseView);
    }];
    
    YLMoreIntegralController *moreIntegral = [[YLMoreIntegralController alloc] init];
    _moreIntegralView = moreIntegral.view;
    _moreIntegralView.hidden = YES;
    [self addChildViewController:moreIntegral];
    [_tableBaseView addSubview:moreIntegral.view];
    [moreIntegral.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.right.bottom.left.mas_equalTo(weakSelf.tableBaseView);
    }];
    
    _totalPointLabel.text = _totalPoint;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)choiceIntergralStyle:(UISegmentedControl *)sender {
    NSInteger index = sender.selectedSegmentIndex;
    if (index == 0) {
        _integralRecordView.hidden = NO;
        _moreIntegralView.hidden = YES;
    } else {
        _integralRecordView.hidden = YES;
        _moreIntegralView.hidden = NO;
    }
}

- (void)dealloc
{
 //   NSLog(@"aa");
}

@end
